Skip to content

feat(genie): add automatic chart visualization for query results#146

Open
calvarjorge wants to merge 9 commits intomainfrom
feat/genie-auto-create-charts
Open

feat(genie): add automatic chart visualization for query results#146
calvarjorge wants to merge 9 commits intomainfrom
feat/genie-auto-create-charts

Conversation

@calvarjorge
Copy link
Contributor

@calvarjorge calvarjorge commented Mar 2, 2026

Summary

  • Chart type inference: Automatically determines the best chart type (bar, line, pie, scatter, table) based on query column metadata (types, cardinality, column count)
  • Inline chart rendering: GenieQueryVisualization component renders charts directly within Genie chat messages alongside SQL query details
  • Dev playground page: Adds a /chart-inference route for testing chart inference with sample datasets

TODO in a subsequent PR:

  • Adding a dropdown to change the default chart

@calvarjorge calvarjorge changed the base branch from main to feat/genie-plugin March 2, 2026 15:06
Base automatically changed from feat/genie-plugin to main March 2, 2026 17:10
@calvarjorge calvarjorge marked this pull request as draft March 3, 2026 13:01
Signed-off-by: Jorge Calvar <jorge.calvar@databricks.com>
…ugins.md

Add @internal JSDoc to genie const to exclude it from generated API
docs. Add Genie plugin section to plugins.md covering configuration,
endpoints, SSE events, and programmatic usage.

Signed-off-by: Jorge Calvar <jorge.calvar@databricks.com>
Signed-off-by: Jorge Calvar <jorge.calvar@databricks.com>
@calvarjorge calvarjorge force-pushed the feat/genie-auto-create-charts branch from 9b2639c to 172af96 Compare March 4, 2026 08:38
calvarjorge and others added 4 commits March 4, 2026 09:40
Replace manual concurrency code (statusQueue, notifyGenerator,
waiterDone, waiterError, IIFE promise chain) with a reusable
pollWaiter async generator that bridges callback-based
waiter.wait({ onProgress }) into a for-await-of loop.

Signed-off-by: Jorge Calvar <jorge.calvar@databricks.com>
- Infer chart type (bar, line, pie, scatter, table) from query column metadata
- Transform Genie query data with column categorization and date parsing
- Render charts inline in chat messages via GenieQueryVisualization component
- Add chart-inference dev playground page and unit tests

Signed-off-by: Jorge Calvar <jorge.calvar@databricks.com>
* feat(appkit-ui): add Genie chat React components and dev-playground demo

Add plug-and-play React components for Genie AI/BI chat:

- useGenieChat hook: manages SSE streaming, conversation persistence
  via URL params, and history replay on page refresh
- GenieChat: all-in-one component wiring hook + UI
- GenieChatMessage: renders messages with markdown (via marked),
  avatars, and collapsible SQL query attachments
- GenieChatMessageList: scrollable message list with auto-scroll,
  loading skeletons, and streaming status indicator
- GenieChatInput: textarea with Enter-to-send and auto-resize

Also adds Genie demo page to dev-playground at /genie and fixes
conversation history ordering in the backend (reverse to chronological).

Signed-off-by: Jorge Calvar <jorge.calvar@databricks.com>

* fix(appkit-ui): address Genie chat UI review feedback

- Rename GENIE_SPACE_ID to DATABRICKS_GENIE_SPACE_ID in env and code
- Hide textarea scrollbar; only show overflow-y when content exceeds max height
- Skip rendering empty assistant bubbles during loading, show only the spinner
- Remove shadow from nested SQL query cards to fix corner shadow artifacts
- Move "New conversation" button to top-right of chat widget

Signed-off-by: Jorge Calvar <jorge.calvar@databricks.com>

* docs: add Genie component documentation with examples

Extend the doc generator to scan genie, multi-genie, and chat component
directories. Add JSDoc descriptions to all Genie components and props,
create usage examples for GenieChat and MultiGenieChat, and generate
8 new doc pages under a "Genie components" sidebar category.

Signed-off-by: Jorge Calvar <jorge.calvar@databricks.com>

* feat(genie): send requestId query param from frontend for SSE reconnection

Generate a UUID per request in useGenieChat and pass it as ?requestId
to the sendMessage and loadHistory SSE endpoints. This allows the server
to use a stable streamId for reconnection and missed-event replay.

Signed-off-by: Jorge Calvar <jorge.calvar@databricks.com>

* chore: genie connector

* refactor(genie): replace sendMessage with streaming implementation

The old non-streaming sendMessage (returning Promise<GenieMessageResponse>)
is replaced by the streaming version (returning AsyncGenerator<GenieStreamEvent>).

Signed-off-by: Jorge Calvar <jorge.calvar@databricks.com>

---------

Signed-off-by: Jorge Calvar <jorge.calvar@databricks.com>
Co-authored-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
@calvarjorge calvarjorge force-pushed the feat/genie-auto-create-charts branch from 172af96 to 74b098c Compare March 4, 2026 08:41
…imeseries charts

Scatter and timeseries charts had two issues: x-axis data arrived in
arbitrary row order from query results, and axis labels were hidden
due to axisLabel being set to undefined. Sort numeric x-data in the
normalization layer and explicitly enable axis labels in the renderer.

Signed-off-by: Jorge Calvar <jorge.calvar@databricks.com>
…chart

Add negative value check to chart inference so pie is not chosen when
data contains negative numbers (falls through to bar). Simplify xField
destructuring in BaseChart.

Signed-off-by: Jorge Calvar <jorge.calvar@databricks.com>
@calvarjorge calvarjorge marked this pull request as ready for review March 4, 2026 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant